clear all
set more off

cd "\workfiles"

use step001_QJE_2, clear


format time %tq

*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
*** 							collapse data 
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


collapse (mean) mean_it12_all=it12_all ///
				infl ///
		 (sd)  	sd_it12_all=it12_all ///
		 (iqr) 	iqr_it12_all=it12_all ///
		 [aw=peso] , by(time treatment_old)

	
***=====================================================================	
*** treatment with past inflation
***=====================================================================		 

*** mean inflation by treatment status
twoway 	(line mean_it12_all time if treatment_old==0, lcolor(black) lwidth(thick) lpattern(solid)) ///
		(line mean_it12_all time if treatment_old==1, lcolor(red) lpattern(longdash)) ///
		(line infl time if treatment_old==1, lcolor(blue) lpattern(shortdash)) ///
		, legend(label(1 "control") label(2 "treated") label(3 "actual") rows(1)) ///
		graphregion(color(white)) bgcolor(white) ///
		ytitle("actual/expected inflation, percent") ///
		xtitle("") ///
		title("Panel A: mean expected inflation") ///
		name(fig1, replace) ///
		xlabel(184(8)236) ///
		xline(210, lpattern(dash_dot) lcolor(green) lwidth(thin)) ///
		text(3.75 216  "Treatment starts", color(green) ) 
	
	

*** st.dev by treatment status
twoway 	(line sd_it12_all time if treatment_old==0, lcolor(black) lwidth(thick) lpattern(solid)) ///
		(line sd_it12_all time if treatment_old==1, lcolor(red) lpattern(longdash)) ///
		(line infl time if treatment_old==1, lcolor(blue) lpattern(shortdash) yaxis(2)) ///
		, legend(label(1 "control") label(2 "treated") label(3 "actual (right axis)") rows(1) ) ///
		graphregion(color(white)) bgcolor(white) ///
		ytitle("disagreement (st.dev.)", axis(1)) ytitle("actual inflation", axis(2)) ///
		xtitle("") ///
		title("Panel B: disagreement in expected inflation") ///
		name(fig2, replace) ///
		xlabel(184(8)236) ///
		xline(210, lpattern(dash_dot) lcolor(green) lwidth(thin)) ///
		text(0.1 216.5  "Treatment starts", color(green) ) ///
		
graph combine fig1 fig2, ///
	rows(2) imargin(tiny) ///
	graphregion(color(white)) ///
	name(comb3, replace) ///
	xsize(11.9) ysize(14.9) 

